<?php

namespace App\Http\Resources\Admin\V1;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class PermissionResource extends JsonResource
{
    /**
     * @expalin 资源格式化
     * @param Request $request
     * @return array
     * @method
     * @author 陈文小超
     * @maxim from专注to执行
     * @time 2021/4/1/9:51
     */
    public function toArray($request)
    {
        return [
            'id'           => (int) $this->id,//权限ID
            'parent_id'    => (int) $this->parent_id,//上级ID
            'name'         => (string) $this->name,//权限标识
            'title'        => (string) $this->title,//标题
            'is_enable'    => (int) $this->is_enable,//是否启用,0:否|1:是
            'created_time' => (int) strtotime($this->created_time),//创建时间
            'updated_time' => (int) strtotime($this->updated_time),//更新时间
        ];
    }
}
